<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<script src="js/common.js"></script>
		<link rel="stylesheet" type="text/css" href="css/index.css"/>
		<script src="js/my_ajax.js"></script>
		<script src="js/preloadjs.min.js"></script>
		<script src="js/flower.js"></script>
	</head>
	<body>
		<div class="web">
			<div class="img"><img src="img/bg.jpg"/></div>
			<div class="progress" max = "100%">
				<div class="fat" style="width: 0;"></div>
			</div>
			<div class="btn">playing</div>
		</div>
		<div class="subject">
			<div class="content">
				<div class="flower"></div>
			</div>
		</div>
		
		<script type="text/javascript">
			var pro = document.querySelector(".progress");
			var fat = document.querySelector(".fat");
			var web = document.querySelector(".web");
			var btn = document.querySelector(".btn");
			var sub = document.querySelector(".subject");
			var baseUrl = "js/img.json";
			var img = document.querySelector(".img img");
			img.onload = function(){
				var tim =setTimeout(function(){
					my_ajax(baseUrl,"get",function(res){
						var loading = new createjs.LoadQueue();
						loading.loadManifest(res);
						loading.on("progress",function(event){
							var num = Math.floor(event.progress*100);
							fat.style.width = num + "%";
						})
						loading.on("complete",function(){
							clearTimeout(tim);
							clearTimeout(tim1);
							var tim1 = setTimeout(function(){
								pro.style.display = "none"; 
								btn.style.display = "block";
								btn.addEventListener("click",function(){
									web.style.display = "none";
									sub.style.display = "block";
								})
							},1000)
						})
						loading.on("error",function(){
							console.log("资源加载错误")
						})
					})
				},2000)
			}
			flow();
		</script>
	</body>
</html>
